<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>接口说明($modelList.size())</title>
<link href="css.css" rel="stylesheet" type="text/css" charset="utf-8" />
<script type="text/javascript" src="js.js" charset="utf-8"></script>
<style>
:not(body) {
	-moz-user-select: text; /*火狐*/
	-webkit-user-select: text;  /*webkit浏览器*/
	-ms-user-select: text;   /*IE10*/
	-khtml-user-select: text; /*早期浏览器*/
	user-select: text;
}
body{
	-moz-user-select: none; /*火狐*/
	-webkit-user-select: none;  /*webkit浏览器*/
	-ms-user-select: none;   /*IE10*/
	-khtml-user-select: none; /*早期浏览器*/
	user-select: none;
}
</style>
</head>

<body>
#macro(action $method)
#replace("\s+","")
	$method.attributes.RequestMapping.value
#end
#end
<!-- $modelList.size() -->
#foreach($model in $modelList)
<!-- $model.name -->
	<h4 id="$model.name">#if($model.label)$!{model.label}#else$!{model.name}#end</h4>
	#foreach($method in $model.methods)
		<!-- ${method.name}() -->
		#set($_isAction = $method.attributes.ACTION_URL && $MU.checkModifier($method, 'public'))
		#if($_isAction)
			<h5 id="${model.name}_$!{method.name}">#if($method.description) $method.description #else $method.name #end</h5>
			<table id="${model.name}_$!{method.name}_table" border="1">
			  <tr>
				<th colspan="5" scope="col">&nbsp;</th>
			  </tr>
			  <tr>
				<td colspan="5">$!method.description&nbsp;</td>
			  </tr>
			  <tr>
				<td>地址</td>
				<td colspan="4" id="${model.name}_$!{method.name}_url">$!method.attributes.ACTION_URL&nbsp;</td>
			  </tr>
			  <tr>
				<td colspan="5">参数</td>
			  </tr>
			  <tr>
				<td class="seqNo">&nbsp;</td>
				<td class="paramName">参数名</td>
				<td class="dataType">类型</td>
				<td class="required">是否必须</td>
				<td class="description">说明</td>
			  </tr>
			  #set($rowNum=1)
			  #foreach($param in $method.parameters)
					#set($_isPrimitive=$MU.isPrimitive($param.type))
					#if(!$_isPrimitive)
						#set($_typeModel=$CONTEXT.findModel($param.type))
					#end
				#if($_isPrimitive || !$_typeModel )
					<tr>
						<td>$rowNum #set($rowNum=$rowNum+1)</td>
						<td>$!param.name&nbsp;</td>
						<td>$CSU.getSimpleType($param.type)&nbsp;</td>
						<td>是</td>
						<td>
							#if($!param.description && !$param.description.trim().isEmpty())
								$!param.description
							#else
								无
							#end
						</td>
					</tr>
				#else	#if($_typeModel)
						#foreach($field in $_typeModel.fields)
							#if(!$field.id && !$field.transient)
							<tr>
								<td>$rowNum #set($rowNum=$rowNum+1)</td>
								<td>$!field.name&nbsp;</td>
								<td>$CSU.getSimpleType($field.type)&nbsp;</td>
								<td>是</td>
								<td>
								#if($field.label && !$field.label.trim().isEmpty())
									$field.label
								#else
									无
								#end
								</td>
							</tr>
							#end
						#end
					#end
				#end
			  #end
			  <tr>
				<td colspan="5">返回结果</td>
			  </tr>
			  <tr>
				<td>&nbsp;</td>
				<td colspan="4" >
				#if($method.returnDescription && !$method.returnDescription.trim().isEmpty())
					$method.returnDescription
				#else
					无
				#end				
				</td>
			  </tr>
			</table>

			<p>&nbsp;</p>
		#end
	#end
#end
<form id="menuForm">
  <div id="suspendedMenu">
    <div class="menuToolbar">
        <a><input type="checkbox" onclick="selectAll(this, true)" />全选</a>
        <a onclick="reverse()">反选</a>
        <a onclick="show(false)">隐藏</a>
        <a onclick="show(true)">显示</a> 
    </div>
  </div>
</form>

</body>
<script>
	function checkMenuItem(anchorId, parentId){
		var openapi_urls = '';
		if(parentId){
			var e = document.getElementById(anchorId+'_url');
			if(e && e.innerHTML){
				var url = e.innerHTML;
				if(openapi_urls.indexOf(url)!=-1){
					return false;
				}
			}
		}
		return true;
	}
	
	var tmpfun = addMenuItem;
	var addMenuItem = function(anchorId, parentId){
		if(checkMenuItem(anchorId, parentId)){
			tmpfun(anchorId, parentId);
		}
	};
	
//#foreach($model in $modelList)

	addMenuItem("$model.name");
//	#foreach($method in $model.methods)

		addMenuItem('${model.name}_$!{method.name}', '$model.name');
//	#end
//#end
</script>
</html>
